{% extends "home/base.html" %}
{% block title %}-同事绩效考核{% endblock %}
{% block scores %}current-item{% endblock %}
{% block mainbody %}
    <div class="main">
        <div class="content-title clear">
            <span class="text">同事考核信息</span>
            <div class="filter">
                 <span>被评测人姓名：
                    <select id="buser-select">
                        <option value="">选择姓名</option>
                        <option value="">全部</option>
                        {% for item in userArr %}
    {#                        <script>console.log({{ buser }}, {{ item.pk }}, typeof ({{ buser }}), typeof ({{ item.pk }}))</script>#}
                            <option  {% ifequal buser item.pk %}selected="selected"{% endifequal %} value="{{ item.pk }}">{{ item.fields.user_name }}</option>
                        {% endfor %}
                    </select>
                </span>
                <span>按日期查询：
                    <select id="date-select">
                        <option value="">选择日期</option>
                        <option value="">全部</option>
                        {% for item in dateArr %}
                            <option  {% ifequal date item.fields.score_date %}selected="selected"{% endifequal %} value="{{ item.fields.score_date }}">{{ item.fields.score_date }}</option>
                        {% endfor %}
                    </select>
                </span>
                <span>排序：
                    <select id="sort-select">
                        <option value="">请选择</option>
                        <option value="">默认</option>
                        <option  {% ifequal sort "0" %}selected="selected"{% endifequal %} value="0">升序</option>
                        <option  {% ifequal sort "1" %}selected="selected"{% endifequal %} value="1">降序</option>
                    </select>
                </span>
            </div>
            {% if status_date %}
                {% ifequal status True %}
                    <a href="/scores_add"><span class="status">开始测评（{{ status_date.fields.score_date }}）</span></a>
                {% else %}
                    <a href="/scores_add"><span class="status">查看测评（{{ status_date.fields.score_date }}）</span></a>
{#                    <span class="status">已测评（{{ status_date.fields.score_date }}）</span>#}
                {% endifequal %}
            {% else %}
                <span class="status">评测未开启</span>
            {% endif %}
        </div>
        <div class="content">
            <table class="content-table scores-table">
                <tr>
                    <td>时间</td>
                    <td>姓名</td>
                    <td>工作任务（40）</td>
                    <td>工作质量（30）</td>
                    <td>工作技能（15）</td>
                    <td>工作态度与责任感（15）</td>
                    <td>总分</td>
                </tr>
                {% for item in data %}
                <tr>
                    <td>{{item.fields.be_review_date}}</td>
{#                    <td>{{item.fields.be_review_id}}</td>#}
                    <td>{{item.fields.be_review_name}}</td>
                    <td>{{item.fields.score_work}}</td>
                    <td>{{item.fields.score_quality}}</td>
                    <td>{{item.fields.score_skill}}</td>
                    <td>{{item.fields.score_attitude}}</td>
                    <td>{{ item.fields.score_work|add:item.fields.score_quality|add:item.fields.score_skill|add:item.fields.score_attitude }}</td>
                </tr>
            {% endfor %}
            </table>
        </div>
    </div>

    <script src="/public/js/common/jquery-1.12.4.min.js"></script>
    <script>
        $(document).ready(function(){
            function select() {
                var _date = $("#date-select").val()
{#                var _ruser = $("#ruser-select").val()#}
                var _buser = $("#buser-select").val()
                var _sort = $("#sort-select").val()
                var date = _date == '' ? '' : '&date=' + _date
{#                var ruser = _ruser == '' ? '' : '&ruser=' + _ruser#}
                var buser = _buser == '' ? '' : '&buser=' + _buser
                var sort = _sort == '' ? '' : '&sort=' + _sort
                var str = buser + date +  sort
                if (str[0] == "&") {
                    str = str.substr(1, str.length - 1)
                }
                window.location.href = str ==  "" ? '/scores' + str : '/scores?' + str
            }
    　　     $('#date-select').change(function(){
                select()
    　　　　  })
{#            $('#ruser-select').change(function(){#}
{#                select()#}
{#    　　　　  })#}
            $('#buser-select').change(function(){
                select()
    　　　　  })
            $('#sort-select').change(function(){
                select()
    　　　　  })
        })
    </script>
{% endblock %}
